﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Coding4Fun.Toolkit.Test.WindowsPhone"
    xmlns:converters="clr-namespace:Coding4Fun.Toolkit.Controls.Converters;assembly=Coding4Fun.Toolkit.Controls">
    
    <converters:ThemedImageConverter x:Key="c4fThemedImageConverter" />
    <converters:ThicknessToGridLengthConverter x:Key="c4fThicknessConverter" />
    
    <Style TargetType="local:ThicknessToGridLengthConverterControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ThicknessToGridLengthConverterControl">
                    <Grid Margin="10" Background="Green">
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="topRow" Height="{Binding Padding, Converter={StaticResource c4fThicknessConverter}, ConverterParameter=Top, RelativeSource={RelativeSource TemplatedParent}}" />
                            <RowDefinition  />
                            <RowDefinition  x:Name="bottomRow"  Height="{Binding Padding, Converter={StaticResource c4fThicknessConverter}, ConverterParameter=Bottom, RelativeSource={RelativeSource TemplatedParent}}" />

                        </Grid.RowDefinitions>
                        <Rectangle Fill="Red" Grid.Row="0" />
                        <Rectangle Fill="Blue" Grid.Row="2" />
                        <TextBlock 
							Padding="{TemplateBinding Padding}"
							Grid.Row="1"
                            TextWrapping="Wrap">
							    Testing margin
                        </TextBlock>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:Coding4FunFooter">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Coding4FunFooter">
                    <StackPanel>
                        <TextBlock 
                            TextWrapping="Wrap"
							Margin="0">
							    Application has been open sourced by
                        </TextBlock>
                        <Image 
                            Name="c4fLogo"
							Margin="0,5,10,5"
							Source="{Binding 
                            Converter={StaticResource c4fThemedImageConverter}, 
                            ConverterParameter=/Coding4Fun.Toolkit.Test.WindowsPhone;component/Media/icons/\{0\}/coding4funLogo.png}"
							Stretch="None"
							HorizontalAlignment="Right" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:Coding4FunWaterMark">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Coding4FunWaterMark">
                    <Image 
						Opacity=".05"  
						Stretch="None"
						VerticalAlignment="Bottom"
						HorizontalAlignment="Right"
						Source="{Binding Converter={StaticResource c4fThemedImageConverter}, ConverterParameter=/Coding4Fun.Toolkit.Test.WindowsPhone;component/Media/icons/\{0\}/head.png}"
						Margin="-20, -20">

                        <Image.Clip>
                            <RectangleGeometry Rect="0,0,255,274" />
                        </Image.Clip>
                    </Image>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>